﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace StevensReceipts.Domain
{
    public class Contact : IEntity
    {
        [Key]
        public int Id { get; set; }

        [StringLength(255)]
        [Required]
        public string Name { get; set; }

        [StringLength(255)]
        public string LegalName { get; set; }

        public int AddressId { get; set; }
        [ForeignKey("AddressId")]
        [JsonIgnore]
        public virtual Address Address { get; set; }

        [Required]
        [StringLength(11)]
        public string GstNumber { get; set; }

        [StringLength(50)]
        public string Phone { get; set; }

        [StringLength(50)]
        public string Fax { get; set; }
        
        public bool IsSystemContact { get; set; }

        public ContactType Type { get; set; }

        [StringLength(50)]
        public string ContactPerson { get; set; }

        [StringLength(100)]
        public string Email { get; set; }

        [StringLength(100)]
        public string Website { get; set; }

        public DateTime? Created { get; set; }

        public DateTime? Modified { get; set; }

        public Contact()
        {
            Created = DateTime.Now;
        }
    }
    public enum ContactType
    {
        Customer,
        Supplier,
        Both
    }
}